package cn.edu.cqvie.atc.tree;

/**
 * 二叉树测试
 *
 * @author Zheng Shaohong
 */
public class TreeTest {

    public static void main(String[] args) {

        Tree tree = new Tree();
        tree.insert(10, "James");
        tree.insert(20, "YAO");
        tree.insert(12, "Kobi");
        tree.insert(1, "Mac");

        tree.insert(3, "Jack");
        tree.insert(0, "Kily");

//        tree.insert(15, "Jack");
//        tree.insert(13, "Kily");
//        System.out.println(tree.root.data);
//        System.out.println(tree.root.rightChild.data);
//        System.out
// .println(tree.root.rightChild.leftChild.data);
//        System.out.println(tree.root.leftChild.data);
//
//
//        Node n = tree.find(1);
//        System.out.println(n);

          // 前序遍历
//        tree.frontOrder(tree.root);

        // 中序遍历
//        tree.inOrder(tree.root);

        // 后序遍历
//        tree.afterOrder(tree.root);

//        tree.delete(3);
        tree.delete(10);
        tree.delete(20);
        tree.delete(12);
        tree.delete(1);
        tree.delete(3);
        tree.delete(0);

        tree.inOrder(tree.root);

    }

}
